+function(){
	var sli = document.getElementsByClassName("spHover");
	//console.log(sli);
	sli[0].onmouseenter = function(){
		this.classList.add("jspHover");
	}
	sli[0].onmouseleave = function(){
		this.classList.remove("jspHover");
	}
}();
// 导航栏的js
+function(){
	var jNavItem = document.querySelectorAll(".jNavItem");
	//console.log(navItem);
	for(var i=0;i<jNavItem.length;i++){
		var dropDown = jNavItem[i].querySelector(".dropDown");
		dropDown.setAttribute("style","width:1349px;left:-656px;");
		jNavItem[i].onmouseenter = function(){
			var downBox = this.querySelector(".downLevel");
			downBox.setAttribute("style","display:block");
		}
		jNavItem[i].onmouseleave = function(){
			var downBox = this.querySelector(".downLevel");
			downBox.setAttribute("style","display:none");
		}
		jNavItem[i].firstElementChild.onclick = function(){
			//console.log(this.parentNode);
			//this.parentNode.classList.remove("navActive");
			$("#tabNavBox>li").removeClass("navActive");
			this.parentNode.classList.add("navActive");
		}
	}
}();
+function(){
	var tabHeight = $(".tabNav").offset().top;
	var windowHeight = $(window).scrollTop();
	//console.log(windowHeight);
	if(windowHeight>tabHeight){
		$("#navBigBox").addClass("tabNavFixed");
	}else{
		$("#navBigBox").removeClass("tabNavFixed");
	}
	//console.log(tabHeight);
	$(window).scroll(function(){
		var windowHeight = $(window).scrollTop();
		if(windowHeight>tabHeight){
			$("#navBigBox").addClass("tabNavFixed");
			$("#navBigBox").fadeIn();
		}else{
			$("#navBigBox").removeClass("tabNavFixed");
		}
	});
}();
// 侧边固定栏的js
+function(){
	$(window).scroll(function(){
		var height = $(window).scrollTop();
		//console.log(height);
		if(height>600){
			//$("#fixedGoTop").css("display","block");
			$("#fixedGoTop").fadeIn(1000);
		}else if(height<600){
			// $("#fixedGoTop")[0].style.display = "none";
			//$("#fixedGoTop").css("display","none");
			$("#fixedGoTop").fadeOut(200);
		};
	});
	$("#fixedGoTop").click(function(){
		//document.documentElement.scrollTop = document.body.scrollTop = 0;
		$('body,html').animate({scrollTop:0},500);
		return false;
	});
}();
$(function(){
	$(".cartBox a").click(function(e){
		e.preventDefault();
		location.href="buycar.html";
	})
})
$(function(){
	var sUrl = window.location.href;
	//console.log(sUrl);
	var i = sUrl.lastIndexOf("/");
	var e = sUrl.lastIndexOf(".");
	var nUrl = sUrl.slice(i+1,e);
	//console.log(nUrl== "eat");
	if(nUrl == "eat" || nUrl == "goods"){
		$(".yinshi").addClass("navActive");
		var _userId = sessionStorage.getItem("email");
		if(_userId !== null){
			$(".login").css("display","none");
			$(".userId").css("display","block");
			$(".userId").html(_userId);
		}
	}else if(nUrl == "index"){
		$(".firstItem").addClass("navActive");
		var _userId = sessionStorage.getItem("email");
		if(_userId !== null){
			$(".login").css("display","none");
			$(".userId").css("display","block");
			$(".userId").html(_userId);
		}
	}else if(nUrl == "Log_in"){
		$(".login").css("display","none");
		sessionStorage["uemail"] = $("#user_email").val();
	}else if(nUrl == "buycar"){
		//console.log(1);
		var _userId = sessionStorage.getItem("email");
		if(_userId !== null){
			$(".login").css("display","none");
			$(".userId").css("display","block");
			$(".userId").html(_userId);
		}
	}
})